import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Scanner;


public class Glueksrad {

	private static int[] wheel = new int[] { 0 , 1 , 2 , 3 , 4 , 5 };
	
	
	public static void main(String[] args) {
		// Dezimal "." statt ","
		Locale.setDefault(Locale.ENGLISH);
		
		double[] probabilities = loadProbabilities();
		
		double test = chance(new int[] { 0 , 2 , 3, 1, 4, 0 , 5 }, probabilities );
		
		int[][] array = combineArray(wheel);
		
		double sum = 0;
		for (int i = 0; i < array.length; i++) {
			sum += (double)chance(array[i], probabilities);
		}
		
		System.out.println(sum);

	}
	
	private static int[][] combineArray(int[] input) {
		  if (input.length == 1) 
		    return new int[][] { input };
		  

		  final List<int[]> results = new LinkedList<int[]>();
		  int[] tempArray = input.clone();
		  for (int i = 0; i < input.length; i++) 
		  {
		    tempArray[0] = input[i];
		    for (int[] childs : combineArray(removeFromArray(input, i))) 
		    {
		      System.arraycopy(childs, 0, tempArray, 1, childs.length);
		      results.add(tempArray.clone());
		    }
		  }

		  return results.toArray(new int[results.size()][]);
		}

	private static int[] removeFromArray(int[] array, int index) {
		  final int[] newArray = new int[array.length - 1];
		  System.arraycopy(array, 0, newArray, 0, index);
		  System.arraycopy(array, index + 1, newArray, index, newArray.length
		        - index);
		  return newArray;
		}
	
	private static double chance(int[] combi, double[] probabilities)
	{
		int currentPosition = 0;
		
		double probability = 1;
		for (int i = 0; i < combi.length; i++) 
		{
			if (i == 0 && currentPosition == combi[0])
				probability *= (double)probabilities[5];
			else
				probability *= (double)probabilities[getSteps(currentPosition, combi[i]) - 1];
			currentPosition = combi[i];
		}
		
		return probability;
	}
	
	private static double[] loadProbabilities()
	{
		FileReader fr;
		try {
			fr = new FileReader("luckyWheel.txt");
			Scanner s = new Scanner(fr);
			
			double[] probabilities = new double[6];
			for (int i = 0; i < 6; i++) 
			{
				probabilities[i] = s.nextDouble();
			}
			fr.close();
			
			return probabilities;
		} catch (FileNotFoundException e1) 
		{
			e1.printStackTrace();
		} catch (IOException e2)
		{
			e2.printStackTrace();
		}
		
		return null;
	}

	private static int getSteps(int first, int last)
	{	
		if (last < first)
			return Math.abs(Math.abs(first - last) - wheel.length);
		else
			return last - first;
	}
}
